function getCookie(key){
    var arr = document.cookie.split("; ");
    for(var i=0;i<arr.length;i++){
        if(arr[i].split("=")[0] === key){
            return arr[i].split("=")[1];
        }
    }
    return "";
}
function removeCookie(key, ops={}){
    ops.expires = -1;
    setCookie(key, null, ops)
}
function setCookie(key, val, ops={}){
    var p = ops.path ? `;path=${ops.path}` : "";
    var dateStr = "";
    if(ops.expires){
        var d =new Date();
        d.setDate(d.getDate() + ops.expires);
        dateStr = `;expires=${d}`;
    }
    document.cookie = `${key}=${val}${p}${dateStr}`;
}